home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / tools / czesc_1 / dr / source / nathanhale.c < prev    next >
C/C++ Source or Header  |  1993-11-21  |  1KB  |  62 lines

  1. /* Turns on the amigados 2.x bit that makes it use the asterisk as a file     */
  2. /* pattern wildcard.  Named after Nathan Hale, who said "I regret that I have */
  3. /* but one asterisk for my country."                                          */
  4.  
  5. /* by Paul Kienitz, 15 January 92, public domain. */
  6.  
  7.  
  8. #include <dos/dosextens.h>
  9. #include <clib/exec_protos.h>
  10. #include <pragmas/exec_lib.h>
  11. #include <clib/dos_protos.h>
  12. #include <pragmas/dos_lib.h>
  13.  
  14.  
  15. struct DosLibrary *DOSBase;
  16.  
  17.  
  18. void spew(char *s)
  19. {
  20.     ULONG strlen();
  21.     register BPTR o = Output();
  22.     if (o) Write(o, s, strlen(s));
  23. }
  24.  
  25.  
  26. long _main()
  27. {
  28.     struct RootNode *rune = DOSBase->dl_Root;
  29.     register long r = 0;
  30.     struct Process *pp = (void *) FindTask(NULL);
  31.     struct Message *WBenchMsg = NULL;
  32.     BPTR wbcon = NULL;
  33.  
  34.     if (!pp->pr_CLI) {
  35.     WaitPort(&pp->pr_MsgPort);
  36.     WBenchMsg = GetMsg(&pp->pr_MsgPort);
  37.     wbcon = Open("con:100/50/500/60/NathanHale", MODE_NEWFILE);
  38.     if (!pp->pr_COS) pp->pr_COS = wbcon;
  39.     spew("\n    ");
  40.     }
  41.     if (DOSBase->dl_lib.lib_Version < 36) {
  42.         spew("Requires AmigaDOS 2.0 or newer.\n");
  43.         return 20;
  44.     }
  45.     if ((rune->rn_Flags ^= RNF_WILDSTAR) & RNF_WILDSTAR)
  46.     spew("ACTIVATING");
  47.     else {
  48.         spew("Turning OFF");
  49.         r = 5;
  50.     }
  51.     spew(" the asterisk-wildcard flag.\n");
  52.     if (wbcon) {
  53.     Delay(75 + 5 * r);
  54.     Close(wbcon);
  55.     }
  56.     if (WBenchMsg) {
  57.     Forbid();
  58.     ReplyMsg(WBenchMsg);
  59.     }
  60.     return r;
  61. }
  62.